<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <div>
      <label>
        Name:
        <input type="text" v-model="name">
      </label>
      <input type="button" value="添加" @click="add">
    </div>
    <p v-for="item in list">
      <input type="checkbox">
      {{item.name}}
    </p>
  </div>
  <script src="js/vue.js"></script>
  <script>
    // 创建 vue 实例,得到 viewModel
    var vm = new Vue({
      el: '#app',
      data: {
        id: '',
        name: '',
        list: [
          { id: 1, name: '范闲' },
          { id: 2, name: '叶轻眉' },
          { id: 3, name: '陈萍萍' }
        ]
      },
      methods: {
        add() {
          this.list.unshift({ id: 6, name: this.name })
        }
      }
    });
  </script>
</body>

</html>